/**
 * @name: config.ts
 * @author: XU>.<CHEN
 * @date: 2022-05-28 10:06
 * @description：数据库配置
 * @update: 2022-05-28 10:06
 */

const mysql = require('mysql')
const db = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'chiyan9527',
  database: 'cheerful_roll_db'
})

export function connect () {
  db.connect((err: any) => {
    if (err) {
      console.log('error connecting: ' + err.stack)
      return
    }
    console.log('DB connected as id ' + db.threadId);
  })
}


export default db